﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_DLL.Product.DAO;
using ERP_RORZE_DLL.Product.database;

namespace ERP_RORZE_PRODUCT.Product.BasicList
{
    public partial class frm_ExpenceEdit : DevExpress.XtraEditors.XtraForm
    {
        public event EventHandler Reload;
        ClsBasicListDAO clsBasiclistDAO = new ClsBasicListDAO();
        Expence b = new Expence();
        public string ExpenceID;
        public string Description;
        public string LaborExp;
        public frm_ExpenceEdit()
        {
            InitializeComponent();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (txtDescription.Text == "")
            {
                MessageBox.Show("Chưa nhập Description");
            }
            else
            {
                b.ExpenceID = txtExpenceID.Text;
                b.Description = txtDescription.Text;
                b.LaborExp = checkLaborExp.Checked;
                clsBasiclistDAO.UpdateExpence(b);
                Reload(sender, e);
            }
        }

        private void frm_ExpenceEdit_Load(object sender, EventArgs e)
        {
            txtExpenceID.Text = ExpenceID;
            txtDescription.Text = Description;
            checkLaborExp.Checked = bool.Parse(LaborExp);
        }
    }
}